import { LocalstorageDataManage } from './../../common/localstoreage/localstoreageDataManage';
import { Component, OnInit, Input } from '@angular/core';
@Component({
    selector: 'ldc-warning',
    template: `
        <div class="ldc-warning" *ngIf="!status">
            <i class="material-icons">warning</i>
            <span>本地数据中心连接失败，请检查收银终端({{LDCConfig.terminal.name}}:{{LDCConfig.host}})是否开机，网络是否正常。</span>
            <i class="material-icons" (click)="close()">clear</i>
        </div>
    `,
    styles: [`
        .ldc-warning{
            background:#d95757;
            color:#fff;
            position:fixed;
            bottom:2.6rem;
            width:100%;
            z-index:10000;
            padding:1rem;
        }
        .ldc-warning span{
            font-size:1.2rem;
        }
        .ldc-warning i{
            vertical-align:bottom;
        }
        .ldc-warning i:last-child{
            float:right;
        }
    `]
})

export class LDCWarning implements OnInit {
    // private isShow: boolean = true;
    private LDCConfig;
    @Input() status;
    ngOnInit() {
        this.LDCConfig = LocalstorageDataManage.current.getLDCConfig();
    }

    close() {
        this.status = true;
    }
}